@extends('pc_admin.app')

@section('content')
<link rel="stylesheet" href="/css/pc-system/attendance-left.css">
<link rel="stylesheet" href="/css/pc-system/user-company.css">
<div class="mian-container">
    <div class="container-section">
        <div class="f-left left-section">
            <div class="title-list top-list active">
                <h3 class="h3-title"><a href="{{url('/front/my-company')}}"><i class="icon iconfont icon-gongsi"></i>所属企业</a></h3>
            </div>
        </div>
        <div class="right-section">
            <div class="user-company">
                <h3 class="company-title">{{$company->name}}</h3>
                <div class="weui-cells">
                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <p>企业全称</p>
                        </div>
                        <div class="weui-cell__bd">
                            {{$company->name}}<img src="/img/com-img.png">
                        </div>
                        <div class="weui-cell__ft">

                        </div>
                    </div>
                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <p>企业口号</p>
                        </div>
                        <div class="weui-cell__ft">
                            {{$company->slogan}}
                        </div>
                    </div>
                    <div class="weui-cell">
                        <div class="weui-cell__hd">
                            <p>创建时间</p>
                        </div>
                        <div class="weui-cell__ft">
                            {{$company->created_at->format('Y-m-d')}}
                        </div>
                    </div>
                    {!! csrf_field() !!}
                    <input type="hidden" name="comid" value="{{$company->id}}">
                    {{--<div class="weui-cell">
                        <div class="weui-cell__hd">
                            <p>创建人</p>
                        </div>
                        <div class="weui-cell__ft">
                            衣晓辉
                        </div>
                    </div>--}}
                </div>
                <a href="javascript:;" class="weui-btn weui-btn_warn set-out">退出企业</a>
            </div>
        </div>
    </div>
</div>
<script>
    $(document).ready(function () {

        var token = $('input[name=_token]').val();
        var comid = $('input[name=comid]').val().trim();
        $('.set-out').click(function () {
            $.confirm({
                title: '确认退出',
                text: '确认退出企业，并解除企业关系',
                onOK: function () {
                    $.ajax({
                        'url': '/front/quit-company?_token='+token,
                        'type': 'POST',
                        'data': 'comid='+comid,
                        'dataType': "json",
                        error: function (request) {
                            layer.msg('网络错误');
                        },
                        success: function (data) {
                            if (data.status == 'success') {
                                layer.msg(data.msg);
                                window.location.href=data.redirectUrl;
                            } else {
                                layer.msg(data.msg);
                            }
                        },
                    });

                },
                onCancel: function () {
                }
            });
        })
    })
</script>
@endsection